package com.oo.inherit_3.automobile;

/**
 * Car--${description}
 *
 * @author: Jovi
 * @createTime: 2017-05-09 13:56
 **/
public class Car extends Bus {

    public Car() {
    }

    public Car(String licensNo, String color, String name, double dailyRent) {
        super(licensNo, color, name, dailyRent);
    }

    @Override
    protected void hire(String name, int day) {
        if (day < 0) {
            System.out.println("日期无效");
            return;
        }

        double money = 0;

        if (day <= 10) {
            money = day * this.getDailyRent();
        } else {
            money = day * this.getDailyRent() + (day - 10) * this.getDailyRent() * 0.1;
        }

        String msg = "租赁信息\n车牌号：" + this.getLicensNo()
                + "\n车型：" + this.getName() +
                "\n颜色：" + this.getColor()+"\n租车人："+name+
                "\n应付金额："+money;
        System.out.println(msg);
    }
}
